#define  _USE_MATH_DEFINES
#include "Trig.h"

namespace Core
{
	const double Trig::E = M_E;
	const double Trig::PI = M_PI;
	const double Trig::OneOverPi = 1.0 / M_PI;
	const double Trig::PiOverTwo = M_PI * 0.5;
	const double Trig::PiOverThree = M_PI / 3.0;
	const double Trig::PiOverFour = M_PI / 4.0;
	const double Trig::PiOverSix = M_PI / 6.0;
	const double Trig::ThreePiOver2 = (3.0 * M_PI) * 0.5;
	const double Trig::TwoPi = 2.0 * M_PI;
	const double Trig::OneOverTwoPi = 1.0 / (2.0 * M_PI);
	const double Trig::RadiansPerDegree = M_PI / 180.0;


	double Trig::ToRadians(double degrees)
	{
		return degrees * RadiansPerDegree;
	}
	Geodetic3D* Trig::ToRadians(Geodetic3D& geodetic)
	{
		return new Geodetic3D(
			ToRadians(geodetic.getLongitude()),
			ToRadians(geodetic.getLatitude()),
			geodetic.getHeight()
			);
	}
	Geodetic2D* Trig::ToRadians(Geodetic2D& geodetic)
	{
		return new Geodetic2D(
			ToRadians(geodetic.getLongitude()),
			ToRadians(geodetic.getLatitude())
			);
	}

	double Trig::ToDegrees(double radians)
	{
		return radians / RadiansPerDegree;
	}
	Geodetic3D* Trig::ToDegrees(Geodetic3D& geodetic)
	{
		return new Geodetic3D(
			ToDegrees(geodetic.getLongitude()),
			ToDegrees(geodetic.getLatitude()),
			geodetic.getHeight()
			);
	}
	Geodetic2D* Trig::ToDegrees(Geodetic2D& geodetic)
	{
		return new Geodetic2D(
			ToDegrees(geodetic.getLongitude()),
			ToDegrees(geodetic.getLatitude())
			);
	}
}